package com.wangzefeng.nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Auther: wangzefeng
 * @Date: 2021/3/11 14:01
 * @Description:
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerGoodsController {

    @Resource
    private RestTemplate restTemplate;

    @Value("${goods.provider.service}")
    private String goodsUrl;

    @GetMapping("/one")
    public String getOneGood(){
        return restTemplate.getForObject(goodsUrl+"/goods/one",String.class);
    }
}
